<template>
	<view>
		<cu-custom :bgLinerBorder="true" :isBlack="false">
			<block slot="content">点餐记录</block>
		</cu-custom>
		<view class="contents">
			<view class="wrap flex m-b-10" v-for="(item,index) in list" :key="index">
				<view class="flex align-center">
					<image :src="item.thumb_url" class="imgs" mode=""></image>
				</view>
				<view class="flex-1 p-l-10 flex flex-direction justify-space-between">
					<view class="f-17 fontBold">
						{{item.goods_name}}
					</view>
					<view class="">
						<view class="flex justify-space-between">
							<view class="f-12 black-9">
								<text v-if="item.goods_attr_str">规格：{{item.goods_attr_str}}</text>
							</view>
							<view class="f-12 nums">
								*{{item.goods_num}}
							</view>
						</view>
						<view class="flex justify-space-between">
							<view class="orange f-17 fontBold">
								￥{{item.price}}
							</view>
							<view class="orange f-17 fontBold">
								￥{{item.real_price}}
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="nodata" v-if="list.length == 0">
			暂无数据~
		</view>
		<view style="height: 130rpx;"></view>
		<view class="bottom-wrap flex justify-center">
			<view class="f-18 orange fontBold" >
				消费金额汇总：￥{{info.total_price||0}}
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id:0,
				info:{},
				list:[],
			}
		},
		onLoad(option) {
			if(option.id){
				this.id = option.id;
			}
			this.getIndex();
		},
		methods: {
			getIndex(){
				let data = {
					order_id:this.id
				}
				this.$http('/apimanager/Shop_Info/OrderInfo',data).then(res=>{
					if(res.code == 200){
						let datas = res.data;
						let list = datas.goods;
						this.info = datas.info;
						this.list = list;
					}
				})
			},
		}
	}
</script>

<style lang="less">
	.bottom-wrap {
		box-shadow: 0px -3px 6px rgba(0, 0, 0, 0.07);
		border-radius: 20px 20px 0 0;
		height: 130rpx;
		position: fixed;
		bottom: 0;
		left: 0;
		z-index: 100;
		background: #ffffff;
		width: 100%;
		padding: 20rpx 30rpx 0 30rpx;
	}
	.wrap{
		background: #FFFFFF;
		box-shadow: 0px 0px 16px rgba(0,0,0,0.05);
		border-radius: 16rpx;
		padding:20rpx;
	}
	.imgs{
		width: 160rpx;
		height: 160rpx;
		border-radius: 16rpx;
	}
	.nums{
		color: #FFCB00;
	}
</style>
